package net.huashitong.index.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.index.dao.DepartmentDao;
import net.huashitong.index.entity.DepartmentEntity;
import net.huashitong.index.filter.DepartmentFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentService extends StringPKService<DepartmentEntity> {

    @Autowired
    private DepartmentDao dao;
    @Autowired
    private SysTableService sysTableService;

    @Override
    protected BaseDao<DepartmentEntity, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(DepartmentEntity obj) {
        obj.setSysId(sysTableService.updateMaxSysId("t_eco_depart",null));
    }


    public List<DepartmentEntity> queryByFilterNoPage(DepartmentFilter filter){
        return dao.queryByFilterNoPage(filter);
    }
}
